package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.BtyCwFine;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyCwFineParam;
import cn.stylefeng.guns.sys.modular.system.service.BtyCwFineService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 财务罚款控制器
 *
 * @author 
 * @Date 2022-01-18 09:49:33
 */
@Controller
@RequestMapping("/btyCwFine")
public class BtyCwFineController extends BaseController {

    private String PREFIX = "/modular/system/btyCwFine";

    @Autowired
    private BtyCwFineService btyCwFineService;

    /**
     * 跳转到主页面
     *
     * @author 
     * @Date 2022-01-18
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyCwFine.html";
    }

    /**
     * 新增页面
     *
     * @author 
     * @Date 2022-01-18
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyCwFine_add.html";
    }

    /**
     * 编辑页面
     *
     * @author 
     * @Date 2022-01-18
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyCwFine_edit.html";
    }

    @RequestMapping("/selectDz")
    public String selectDz(BtyCwFineParam btyCwFineParam, Model model) {
        model.addAttribute("id", btyCwFineParam.getId());
        return PREFIX + "/btyCwFine_selectDz.html";
    }

    /**
     * 新增接口
     *
     * @author 
     * @Date 2022-01-18
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyCwFineParam btyCwFineParam) {
        this.btyCwFineService.add(btyCwFineParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author
     * @Date 2022-01-18
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyCwFineParam btyCwFineParam) {
        this.btyCwFineService.update(btyCwFineParam);
        return ResponseData.success();
    }

    /**
     * 编辑财务罚款
     *
     */
    @RequestMapping("/editById")
    @ResponseBody
    public ResponseData editById(BtyCwFineParam btyCwFineParam) {
        this.btyCwFineService.editById(btyCwFineParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author 
     * @Date 2022-01-18
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyCwFineParam btyCwFineParam) {
        this.btyCwFineService.delete(btyCwFineParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author 
     * @Date 2022-01-18
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyCwFineParam btyCwFineParam) {
        BtyCwFine detail = this.btyCwFineService.getById(btyCwFineParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author 
     * @Date 2022-01-18
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyCwFineParam btyCwFineParam) {
        return this.btyCwFineService.findPageBySpec(btyCwFineParam);
    }

    /**
     * 同步店名
     *
     */
    @ResponseBody
    @RequestMapping("/synData")
    public ResponseData synData(String month){
        return this.btyCwFineService.synData(month);
    }

    /**
     * 店名列表
     */
    @ResponseBody
    @RequestMapping("/dmList")
    public ResponseData dmList(){
        return this.btyCwFineService.dmList();
    }

    /**
     * 批量审核
     * @param month
     * @return
     */
    @ResponseBody
    @RequestMapping("/batchAudit")
    public ResponseData batchAudit(String month){
        return this.btyCwFineService.batchAudit(month);
    }

    /**
     * 审核通过
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/audit")
    public ResponseData audit(Long id){
        return this.btyCwFineService.audit(id);
    }

    /**
     * 撤回
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/recall")
    public ResponseData recall(Long id){
        return this.btyCwFineService.recall(id);
    }

    /**
     * 同步到货赔审核
     * @param month
     * @return
     */
    @ResponseBody
    @RequestMapping("/synGoodspay")
    public ResponseData synGoodspay(String month){
        return this.btyCwFineService.synGoodspay(month);
    }

}


